package com.interview.ujiuye;

import java.io.InputStream;
import java.net.Socket;

public class MyClient1 {
	public static void main(String[] args) throws Exception {
		//1.创建Socket客户端对象
		Socket socket = new Socket("localhost", 8888);
		//2.获取服务器发送的信息
		InputStream inputStream = socket.getInputStream();
		byte[] b = new byte[1024];
		int len = inputStream.read(b);
		System.out.println("读取的字节数:" + len);
		System.out.println("服务器说:"+ new String(b,0,len));
		inputStream.close();
		socket.close();
	}
}